package com.dlc.beijingrfid.activity;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import butterknife.BindView;
import com.dlc.commonlibrary.widget.TitleBar;
import com.dlc.beijingrfid.R;
import com.dlc.beijingrfid.base.BaseActivity;
import com.dlc.beijingrfid.net.bean.SimpleBean;
import com.dlc.beijingrfid.net.exception.ErrorMsgException;
import com.dlc.beijingrfid.net.protocol.UserProto;
import com.dlc.beijingrfid.net.protocol.base.HttpProtocol;

/**
 * Created by kawaimisashi on 2017/7/19 0019.
 */

public class OpinionFeedbackActivity extends BaseActivity {
    @BindView(R.id.titleBar)
    TitleBar titleBar;
    @BindView(R.id.opinion_et)
    EditText opinion_et;
    @Override
    protected int getLayoutID() {
        return R.layout.activity_opinion_feedback;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        titleBar.leftExit(this);
    }
    public void submit(View view){
        String opionionStr =opinion_et.getText().toString();
        if(TextUtils.isEmpty(opionionStr)){
            showToast("請輸入您的反饋意見");
            return;
        }
        UserProto.get().opinionFeedback(opionionStr, new HttpProtocol.Callback<SimpleBean>() {
            @Override
            public void onSuccess(SimpleBean simpleBean) {
                showToast(simpleBean.msg);
                finish();
            }

            @Override
            public void onFailed(int code, ErrorMsgException e) {
                showOneToast(e.getMessage());

            }
        });

    }
}
